
#ifndef	LEVEL_HPP
#define	LEVEL_HPP

#include <level/level_fwd.hpp>
#include <level/slide/slide.hpp>
#include <level/player/player.hpp>
#include <sfml/helper.hpp>
#include <vector>
#include <string>

class level
{
	public:

		typedef boost::shared_ptr< slide > slide_ptr;

		level( std::string const & filename );
		void step( float delta_time );
		void draw( );

		std::string const & filename( ) const
		{
			return m_filename;
		}

		float time_elapsed( ) const
		{
			return m_time;
		}

		::player & player( )
		{
			return m_player;
		}

		slide_ptr current_slide( ) const
		{
			return m_slides[m_active];
		}

		slide_ptr next_slide( )
		{
			m_active = ( m_active + 1 ) % m_slides.size( );
			return current_slide( );
		}

		slide_ptr previous_slide( )
		{
			m_active = m_active > 0 ? m_active - 1 : m_slides.size( ) - 1;
			return current_slide( );
		}

		size_t active( ) const
		{
			return m_active;
		}

		void active( size_t new_active )
		{
			m_active = new_active;
		}

	private:

		typedef std::vector< slide_ptr > slide_vector_t;

		std::string m_filename;
		slide_vector_t m_slides;
		size_t m_active;
		sprite_ptr m_hud;
		float m_time;
		
		::player m_player;
};

#endif	//LEVEL_HPP
